*Replication 

global pretreat_tr age i.female i.ed1 i.urban gendemoc_pre i.polint i.turnout_dum

*****MICRO MODELS DEFENDING PARTIES
****TABLE 1
 eststo t1_2: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr , absorb(country)
 eststo t2_1: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if v2cacamps_osp<2.84 , absorb(country)
 eststo t2_2: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if v2cacamps_osp>2.84 & v2cacamps_osp!=., absorb(country)
 eststo t2_3: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if regime==0 , absorb(country)
 eststo t2_4: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if regime==1 , absorb(country)
 
  esttab t1_2 t2_1 t2_2 t2_3 t2_4 using "Table2.tex",  keep(*treat_dum  *affpolwgt_parl_wagner2  *treat_dum#*affpolwgt_parl_wagner2 ) tex replace b(%10.3f) se stats(N r2 fe controls, fmt(0 3) labels("N" "\$R^{2}\$" "Country FE" "Covariates")) starlevels(* .05 ** .01 *** .001) alignment(l) compress label long nonote nogaps nonumbers noomit nobase unstack mtitle("Model 1" "Model 2" "Model 3" "Model 4" "Model 5") 
  

*set scheme plotplain
areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr , absorb(country)
margins, at(affpolwgt_parl_wagner2=(0(1)5) treat_dum=(0(1)1) )
marginsplot, legen(pos(6) col(2)) title("") recast(line) plot2opts(lpattern(dash)) xtitle("Partisan polarization") ytitle("Predicted Likelihood of Defending Democracy") scheme(plotplain) scale(1.4)

  graph export "C:/Users/melek/Desktop/RA_Finkel/BJPS/publication/figure1.png", width(3600) height(2400) replace
****TABLE 2

*Table 3
 eststo t3_2: areg affchangewagnerwgt_parl2 treat_dum affpolwgt_parl_wagner2 $pretreat_tr, absorb (country)
 eststo t3_3: areg affchangewagnerwgt_parl2 treat_dum affpolwgt_parl_wagner2 $pretreat_tr if v2cacamps_osp<2.84, absorb (country)
 eststo t3_4: areg affchangewagnerwgt_parl2 treat_dum affpolwgt_parl_wagner2 $pretreat_tr if v2cacamps_osp>2.84 & v2cacamps_osp!=., absorb (country)
 eststo t3_5: areg affchangewagnerwgt_parl2 treat_dum affpolwgt_parl_wagner2 $pretreat_tr if regime==0, absorb (country)
 eststo t3_6: areg affchangewagnerwgt_parl2 treat_dum affpolwgt_parl_wagner2 $pretreat_tr if regime==1, absorb (country)


  esttab t3_2 t3_3 t3_4 t3_5 t3_6 using "Table3.tex", keep(*treat_dum  ) tex replace b(%10.3f) se stats(N r2 fe controls, fmt(0 3) labels("N" "\$R^{2}\$" "Country FE" "Covariates")) starlevels(* .05 ** .01 *** .001) alignment(l) compress label long nonote nogaps nonumbers noomit nobase unstack mtitle("Model 1" "Model 2" "Model 3" "Model 4" "Model 5") 
  
  ***TABLE 3 
****DEM PARTY CHANGE 
 eststo t4_1: areg avedem_change i.treat_dum ave_dem  $pretreat_tr, absorb(country) 

***UNDEM PARTY CHANGE
 eststo t4_2: areg aveundem_change i.treat_dum ave_undem  $pretreat_tr, absorb(country) 


  esttab t4_1 t4_2 using "Table4.tex", keep(*treat_dum ) tex replace b(%10.3f) se stats(N r2 fe controls, fmt(0 3) labels("N" "\$R^{2}\$" "Country FE" "Covariates")) starlevels(* .05 ** .01 *** .001) alignment(l) compress label long nonote nogaps nonumbers noomit nobase unstack mtitle("Model 1" "Model 2" ) 
 
 *APPENDIX
*without covariates
****TABLE 1
 eststo m1_0: areg defending_parties treat_dum affpolwgt_parl_wagner2, absorb(country)
 eststo m1_1: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2, absorb(country)
 eststo m1_2: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 if v2cacamps_osp<2.84 , absorb(country)
 eststo m1_3: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 if v2cacamps_osp>2.84 & v2cacamps_osp!=., absorb(country)
 eststo m1_4: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 if regime==0 , absorb(country)
 eststo m1_5: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 if regime==1 , absorb(country)
  esttab m1_0 m1_1 m1_2 m1_3 m1_4 m1_5 using "Tablem1.tex", tex replace b(%10.3f) se stats(N r2 fe, fmt(0 3) labels("N" "\$R^{2}\$" "Country FE" )) starlevels(* .05 ** .01 *** .001) alignment(l) compress label long nonote nogaps nonumbers noomit nobase unstack mtitle("Model 1" "Model 2" "Model 3" "Model 4" "Model 5" "Model 6") 
 
 eststo m1_6: areg affchangewagnerwgt_parl2 i.treat_dum c.affpolwgt_parl_wagner2, absorb (country)
 eststo m1_7: areg affchangewagnerwgt_parl2 i.treat_dum affpolwgt_parl_wagner2 if v2cacamps_osp<2.84 , absorb (country)
 eststo m1_8: areg affchangewagnerwgt_parl2 i.treat_dum affpolwgt_parl_wagner2 if v2cacamps_osp>2.84 & v2cacamps_osp!=., absorb (country)
 eststo m1_9: areg affchangewagnerwgt_parl2 i.treat_dum affpolwgt_parl_wagner2 if regime==0, absorb (country)
 eststo m1_10: areg affchangewagnerwgt_parl2 i.treat_dum affpolwgt_parl_wagner2 if regime==1, absorb (country)
 
   esttab  m1_6 m1_7 m1_8 m1_9 m1_10 using "Tablem1_1.tex", tex replace b(%10.3f) se stats(N r2 fe, fmt(0 3) labels("N" "\$R^{2}\$" "Country FE" )) starlevels(* .05 ** .01 *** .001) alignment(l) compress label long nonote nogaps nonumbers noomit nobase unstack mtitle("Model 1" "Model 2" "Model 3" "Model 4" "Model 5") 
 
  eststo m1_11: areg avedem_change i.treat_dum ave_dem  , absorb(country) 
 eststo m1_12: areg aveundem_change i.treat_dum ave_undem , absorb(country) 


  esttab m1_11 m1_12 using "Tablem1_2.tex", tex replace b(%10.3f) se stats(N r2 fe, fmt(0 3) labels("N" "\$R^{2}\$" "Country FE")) starlevels(* .05 ** .01 *** .001) alignment(l) compress label long nonote nogaps nonumbers noomit nobase unstack mtitle("Model 1" "Model 2" ) 
 
 
 *full models
 eststo m2_0: areg defending_parties treat_dum affpolwgt_parl_wagner2 $pretreat_tr , absorb(country)
 eststo m2_1: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr , absorb(country)
 eststo m2_2: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if v2cacamps_osp<2.84 , absorb(country)
 eststo m2_3: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if v2cacamps_osp>2.84 & v2cacamps_osp!=., absorb(country)
 eststo m2_4: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if regime==0 , absorb(country)
 eststo m2_5: areg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if regime==1 , absorb(country)

  esttab m2_0 m2_1 m2_2 m2_3 m2_4 m2_5 using "Tablem2.tex",  tex replace b(%10.3f) se stats(N r2 fe, fmt(0 3) labels("N" "\$R^{2}\$" "Country FE" )) starlevels(* .05 ** .01 *** .001) alignment(l) compress label long nonote nogaps nonumbers noomit nobase unstack mtitle("Model 1" "Model 2" "Model 3" "Model 4" "Model 5" "Model 6") 
  
   eststo m2_6: areg affchangewagnerwgt_parl2 i.treat_dum c.affpolwgt_parl_wagner2 $pretreat_tr, absorb (country)
 eststo m2_7: areg affchangewagnerwgt_parl2 i.treat_dum affpolwgt_parl_wagner2 $pretreat_tr if v2cacamps_osp<2.84, absorb (country)
 eststo m2_8: areg affchangewagnerwgt_parl2 i.treat_dum affpolwgt_parl_wagner2 $pretreat_tr if v2cacamps_osp>2.84 & v2cacamps_osp!=., absorb (country)
 eststo m2_9: areg affchangewagnerwgt_parl2 i.treat_dum affpolwgt_parl_wagner2 $pretreat_tr if regime==0, absorb (country)
 eststo m2_10: areg affchangewagnerwgt_parl2 i.treat_dum affpolwgt_parl_wagner2 $pretreat_tr if regime==1, absorb (country)
 
   esttab  m2_6 m2_7 m2_8 m2_9 m2_10 using "Tablem2_1.tex", tex replace b(%10.3f) se stats(N r2 fe, fmt(0 3) labels("N" "\$R^{2}\$" "Country FE" )) starlevels(* .05 ** .01 *** .001) alignment(l) compress label long nonote nogaps nonumbers noomit nobase unstack mtitle("Model 1" "Model 2" "Model 3" "Model 4" "Model 5") 
 
   eststo m2_11: areg avedem_change i.treat_dum ave_dem  $pretreat_tr , absorb(country) 
 eststo m2_12: areg aveundem_change i.treat_dum ave_undem  $pretreat_tr, absorb(country) 
 
  esttab m2_11 m2_12 using "Tablem2_2.tex", tex replace b(%10.3f) se stats(N r2 fe, fmt(0 3) labels("N" "\$R^{2}\$" "Country FE")) starlevels(* .05 ** .01 *** .001) alignment(l) compress label long nonote nogaps nonumbers noomit nobase unstack mtitle("Model 1" "Model 2" ) 
 
*individual treatment effects
*** Generate each treatment versus placebo

*****MICRO MODELS DEFENDING PARTIES
****TABLE 1

 eststo c_2: areg defending_parties i.treat##c.affpolwgt_parl_wagner2 $pretreat_tr , absorb(country)

 eststo c2_1: areg defending_parties i.treat##c.affpolwgt_parl_wagner2 $pretreat_tr if v2cacamps_osp<2.84 , absorb(country)
 eststo c2_2: areg defending_parties i.treat##c.affpolwgt_parl_wagner2 $pretreat_tr if v2cacamps_osp>2.84 & v2cacamps_osp!=., absorb(country)
 eststo c2_3: areg defending_parties i.treat##c.affpolwgt_parl_wagner2 $pretreat_tr if regime==0 , absorb(country)
 eststo c2_4: areg defending_parties i.treat##c.affpolwgt_parl_wagner2 $pretreat_tr if regime==1 , absorb(country)
 
  esttab c_2 c2_1 c2_2 c2_3 c2_4 using "TableA2.tex",  tex replace b(%10.3f) se stats(N r2 fe controls, fmt(0 3) labels("N" "\$R^{2}\$" "Country FE" "Covariates")) starlevels(* .05 ** .01 *** .001) alignment(l) compress label long nonote nogaps nonumbers noomit nobase unstack mtitle("Model 1" "Model 2" "Model 3" "Model 4" "Model 5") 
  

****TABLE 2
 eststo c3_2: areg affchangewagnerwgt_parl2 i.treat c.affpolwgt_parl_wagner2 $pretreat_tr, absorb (country)
 eststo c3_3: areg affchangewagnerwgt_parl2 i.treat affpolwgt_parl_wagner2 $pretreat_tr if v2cacamps_osp<2.84, absorb (country)
 eststo c3_4: areg affchangewagnerwgt_parl2 i.treat affpolwgt_parl_wagner2 $pretreat_tr if v2cacamps_osp>2.84 & v2cacamps_osp!=., absorb (country)
 eststo c3_5: areg affchangewagnerwgt_parl2 i.treat affpolwgt_parl_wagner2 $pretreat_tr if regime==0, absorb (country)
 eststo c3_6: areg affchangewagnerwgt_parl2 i.treat affpolwgt_parl_wagner2 $pretreat_tr if regime==1, absorb (country)


  esttab c3_2 c3_3 c3_4 c3_5 c3_6 using "TableA3.tex", tex replace b(%10.3f) se stats(N r2 fe controls, fmt(0 3) labels("N" "\$R^{2}\$" "Country FE" "Covariates")) starlevels(* .05 ** .01 *** .001) alignment(l) compress label long nonote nogaps nonumbers noomit nobase unstack mtitle("Model 1" "Model 2" "Model 3" "Model 4" "Model 5") 



***TABLE 3
****DEM PARTY CHANGE 
 eststo c4_1: areg avedem_change i.treat ave_dem  $pretreat_tr , absorb(country) 

***UNDEM PARTY CHANGE
 eststo c4_2: areg aveundem_change i.treat ave_undem  $pretreat_tr, absorb(country) 


  esttab c4_1 c4_2 using "TableA4.tex", tex replace b(%10.3f) se stats(N r2 fe controls, fmt(0 3) labels("N" "\$R^{2}\$" "Country FE" "Covariates")) starlevels(* .05 ** .01 *** .001) alignment(l) compress label long nonote nogaps nonumbers noomit nobase unstack mtitle("Model 1" "Model 2" ) 
 
 
 **country by country results
 
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Bolivia"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Chile"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Colombia"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Dominican Republic"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Ecuador"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="El Salvador"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Honduras"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Malaysia"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Mexico"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Nicaragua"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Paraguay"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Peru"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Philippines"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Tanzania"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Turkey"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Venezuela"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="United States of America"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Hong Kong"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Australia"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Bangladesh"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Argentina"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Ghana"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Guatemala"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="India"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Kenya"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Nigeria"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Pakistan"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Singapore"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="South Africa"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Spain"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Uganda"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="Zambia"
reg defending_parties i.treat_dum##c.affpolwgt_parl_wagner2 $pretreat_tr if country_name=="United Kingdom"

**


